/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sbbs.base.entity;

import java.util.Objects;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.TableGenerator;

/**
 *
 * @author Administrator
 */
public class DemoTableIdEntity extends BaseEntity<Long> {

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "tableGenerator")
    @TableGenerator(name = "tableGenerator", table = "hibernateIdTable",
            pkColumnName = "pk_key", valueColumnName = "pk_value", pkColumnValue = "demoId",
            initialValue = 1, allocationSize = 1)
    public Long getId() {
        return this.getPk();
    }

    public void setId(Long id) {
        this.setPk(id);
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 59 * hash + Objects.hashCode(this.getPk());
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final DemoTableIdEntity other = (DemoTableIdEntity) obj;
        if (!Objects.equals(this.getPk(), other.getPk())) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "DemoTableIdEntity{" + "id=" + getPk() + '}';
    }

}
